<template>
  <el-form :model="formData" :rules="rules" ref="formCom">
    <el-form-item prop="enterpriseName" label="企业名称">
      <el-input v-model="formData.enterpriseName"></el-input>
    </el-form-item>
    <el-form-item prop="enterpriseAddress" label="企业地址">
      <el-input v-model="formData.enterpriseAddress"></el-input>
    </el-form-item>
    <el-form-item prop="enterpriseLogo" label="企业Logo">
      <el-input v-model="formData.enterpriseLogo"></el-input>
    </el-form-item>
    <el-form-item prop="enterpriseCharter" label="营业执照">
      <el-input v-model="formData.enterpriseCharter"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submit"> 提交 </el-button>
      <el-button @click="emits('cancel')">取消</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { reactive, ref } from 'vue'

const emits = defineEmits(['submit', 'cancel'])
const formCom = ref()

const formData = reactive({
  nickName: '',
  userName: '',
  password: '',
  phonenumber: '',
  email: '',
})

const rules = reactive({
  enterpriseName: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
  enterpriseAddress: [{ required: true, message: '请输入地址', trigger: 'blur' }],
})

const submit = () => {
  formCom.value.validate((valid) => {
    if (valid) {
      emits('submit', formData)
    }
  })
}
</script>

<style lang="scss" scoped></style>
